home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / ANGLES.dxr / 00072.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.2 KB  |  44 lines

  1. on AngleFun SpLine
  2.   puppetSprite(SpLine, 1)
  3.   set the trails of sprite SpLine to 1
  4.   set x to the width of sprite SpLine
  5.   set y to the height of sprite SpLine
  6.   set r to float(sqrt((x * x) + (y * y)))
  7.   set theta to -float(atan(float(y) / float(x)))
  8.   set x0 to the left of sprite SpLine
  9.   set y0 to the top of sprite SpLine
  10.   repeat with n = 0 to 75
  11.     if the mouseDown then
  12.       exit repeat
  13.     end if
  14.     set the foreColor of sprite SpLine to random(250)
  15.     set theta to theta + 0.01745
  16.     set x1 to x0 + (r * cos(theta))
  17.     set y1 to y0 - (r * sin(theta))
  18.     drawLine(SpLine, y0, x0, y1, x1)
  19.     updateStage()
  20.     startTimer()
  21.     repeat while the timer < 1
  22.     end repeat
  23.   end repeat
  24.   repeat with n = 0 to 75
  25.     if the mouseDown then
  26.       exit repeat
  27.     end if
  28.     set the foreColor of sprite SpLine to random(250)
  29.     set theta to theta - 0.01745
  30.     set x1 to x0 + (r * cos(theta))
  31.     set y1 to y0 - (r * sin(theta))
  32.     drawLine(SpLine, y0, x0, y1, x1)
  33.     updateStage()
  34.     startTimer()
  35.     repeat while the timer < 1
  36.       nothing()
  37.     end repeat
  38.   end repeat
  39.   spriteBox(SpLine, 1000, 1100, 1200, 1300)
  40.   puppetSprite(SpLine, 0)
  41.   set the trails of sprite SpLine to 0
  42.   updateStage()
  43. end
  44.